package org.yejiali.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import org.yejiali.annotaion.SystemLog;
import org.yejiali.common.response.ResponseResult;
import org.yejiali.domain.entity.User;
import org.yejiali.service.UserService;


/**
 * 用户表(User)表控制层
 *
 * @author yejiali
 * @since 2025-02-28 20:06:58
 */
@RestController
@RequestMapping("user")
public class UserController {

    @Autowired
    private UserService userService;

    @GetMapping("/userInfo")
    public ResponseResult userInfo(){
        return userService.userInfo();
    }

    @PutMapping("/userInfo")
    @SystemLog(businessName = "更新用户信息")
    public ResponseResult updateUserInfo(@Validated @RequestBody User user){
        return userService.updateUserInfo(user);
    }

    @PostMapping("/register")
    public ResponseResult register(@Validated @RequestBody User user){
        return userService.register(user);
    }

}

